package pico.picoScannerParser;

import ebnf.ebnfScannerParser.EBNFTokenKinds;
/**
 * A Token is a piece of the grammar recognized by the scanner
 * @author Bart Wentink & Sander Meijer
 */
public class PicoToken {

	private String kind;
	private String text;
	private int line;
	private int column;

	/**
	 * Create a new token.
	 * 
	 * @param {@link Integer} kind ({@link EBNFTokenKinds})
	 * @param {@link Integer} line
	 * @param {@link Integer} column
	 * @param {@link String} tekst
	 */
	public PicoToken(String kind, int line, int column, String text) {
		assert line > 0 && column > 0;
		assert text != null;

		this.kind = kind;
		this.text = text;
		this.line = line;
		this.column = column;
	}

	/**
	 * {@linkTokenKinds}
	 */
	public String getKind() {
		return kind;
	}

	public String getText() {
		return text;
	}

	public int getColumn() {
		return column;
	}

	public int getLine() {
		return line;
	}

	/**
	 * To String method
	 */
	public String toString() {
		return new StringBuffer().append("Token (").append(line).append('/')
				.append(column).append(',').append(kind).append(',')
				.append('\'').append(text).append('\'').append(')').toString();
	}
}
